package com.liugui.lambda;

import java.util.function.Predicate;
import java.util.stream.IntStream;

/**
 * @ClassName: PredicateDemo
 * @Author: liugui
 * @Date: 2020-11-05 10:50
 **/
public class PredicateDemo {
    public static void main(String[] args) {
        //简单使用  判断a是否大于50
        Predicate<Integer> predicate = a -> a > 50;
        System.out.println(predicate.test(52));

        // System.out.println(intPredicate.test(50));
        IntStream.of(10,11,44,59,46,55,99,88,50)
                //结合filter过滤数字 小于或等于50的数字被过滤
                .filter(a -> a > 50)
                .peek(System.out::println).count();
    }
}
